import { Navigate } from 'react-router-dom'

// 一级路由
import NotFind from '../views/404'
import Login from "../views/Login"
import Main from "../views/Main"

// 二级路由
import About from '../views/Main/About'
import Home from '../views/Main/Home'

// 三级路由
import Message from '../views/Main/Home/Message'
import News from '../views/Main/Home/News'

const routes = [
  {
    path: '/login',
    element: <Login />
  },
  {
    path: '/main',
    element: <Main />,
    children: [
      {
        path: '/main/about',
        element: <About />
      },
      {
        path: '/main/home',
        element: <Home />,
        children: [
          {
            path: '/main/home/message',
            element: <Message />
          },
          {
            path: '/main/home/news',
            element: <News />
          }
        ]
      },
      {
        path: '/main/',
        element: <Navigate to='/main/about' />
      }
    ]
  },
  {
    path: '/',
    element: <Navigate to='/login' />
  },
  {
    path: '*',
    element: <NotFind />
  }
]

export default routes